Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix filename* parsing #3768

Merged
merged 2 commits into from
Oct 25, 2024
Merged

Conversation

KhafraDev
Copy link
Member

fixes #3760

also fixes a case where we were too strict by disallowing spaces after filename and filename* parameters. The RFC uses examples with spaces (filename*= UTF-8''%e2%82%ac%20rates)

it also adds a cause to errors that gives a little more information rather than the bland "failed to parse form-data!" one

headerValue[3] !== 0x2d || // -
headerValue[4] !== 0x38 // 8
) {
throw parsingError('unknown encoding, expected utf-8\'\'')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if utf-8 is the only accepted value here. Could not find references to other encodings in the RFC.

Copy link
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are ways to cover this with test?

@KhafraDev
Copy link
Member Author

I may have forgotten to commit the tests...

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 211cc27 into nodejs:main Oct 25, 2024
28 of 32 checks passed
@KhafraDev KhafraDev deleted the formdata-parser-updates branch October 25, 2024 14:59
@github-actions github-actions bot mentioned this pull request Dec 3, 2024
This was referenced Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Failed to parse body as FormData." with filename*=utf-8 content disposition
3 participants